package com.yueman.ptoolopenticket.ticket.mapper;

import com.yueman.ptoolopenticket.ticket.pojo.SubAcctRecharge;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface TicketSubAcctRechargeRepository extends JpaRepository<SubAcctRecharge, Integer> {
    @Query(nativeQuery = true,value="update SubAcctRecharge s set s.rechargeStatus=?2 where s.subAcct=?1")
    SubAcctRecharge UpdateSubAcctRecharge(String subAcct,String rechargestatus);

    SubAcctRecharge findByOrdernumber(String ordernumber);

    @Query("update SubAcctRecharge t set t.updateTime=:#{#subAcctRecharge.updateTime},t.rechargeStatus=:#{#subAcctRecharge.rechargeStatus} where t.ordernumber=:#{#subAcctRecharge.ordernumber}")
    @Modifying
    @Transactional
    Integer update(@Param("subacctRecharge") SubAcctRecharge subAcctRecharge);

}
